package com.pet.server.po;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * UserInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user_article")
public class UserArticle implements java.io.Serializable {

	// Fields

	private Integer Id;
	private Integer userId;
	private Date createDate;
	private Integer aritcleId;
	private String nickName;
	private String title;
	private String description;
	private String state;
	private String cate;
	private String petCate;
	private String ageCate;
	
	// Constructors

	/** default constructor */
	public UserArticle() {
	}

	
	public UserArticle(Integer id, Integer userId, Date createDate,
			Integer aritcleId, String nickName, String title,
			String description, String state, String cate, String petCate,
			String ageCate) {
		super();
		Id = id;
		this.userId = userId;
		this.createDate = createDate;
		this.aritcleId = aritcleId;
		this.nickName = nickName;
		this.title = title;
		this.description = description;
		this.state = state;
		this.cate = cate;
		this.petCate = petCate;
		this.ageCate = ageCate;
	}


	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return Id;
	}



	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		Id = id;
	}


	@Column(name = "user_id", length = 8)
	public Integer getUserId() {
		return userId;
	}

	/**
	 * @param userId the userId to set
	 */
	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	/**
	 * @return the createDate
	 */
	@Column(name = "create_date", length = 8)
	public Date getCreateDate() {
		return createDate;
	}

	/**
	 * @param createDate the createDate to set
	 */
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	/**
	 * @return the aritcleId
	 */
	
	@Column(name = "article_id", length = 20)
	public Integer getAritcleId() {
		return aritcleId;
	}

	/**
	 * @param aritcleId the aritcleId to set
	 */
	public void setAritcleId(Integer aritcleId) {
		this.aritcleId = aritcleId;
	}

	@Formula("(SELECT f.nick_name FROM user_info f WHERE 1=1 and f.user_id=user_id )")
	public String getNickName() {
		return nickName;
	}


	/**
	 * @param nickName the nickName to set
	 */
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}


	@Formula("(SELECT u.title FROM article u WHERE u.article_id=article_id)")
	public String getTitle() {
		return title;
	}


	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}


	@Formula("(SELECT u.description FROM article u WHERE u.article_id=article_id)")
	public String getDescription() {
		return description;
	}


	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}


	@Column(name = "state", length = 10)
	public String getState() {
		return state;
	}


	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}


	/**
	 * @return the cate
	 */
	@Formula("(SELECT u.cate FROM article u WHERE u.article_id=article_id)")
	public String getCate() {
		return cate;
	}


	/**
	 * @param cate the cate to set
	 */
	public void setCate(String cate) {
		this.cate = cate;
	}


	/**
	 * @return the petCate
	 */
	@Formula("(SELECT u.pet_cate FROM article u WHERE u.article_id=article_id)")
	public String getPetCate() {
		return petCate;
	}


	/**
	 * @param petCate the petCate to set
	 */
	public void setPetCate(String petCate) {
		this.petCate = petCate;
	}


	@Formula("(SELECT u.age_cate FROM article u WHERE u.article_id=article_id)")
	public String getAgeCate() {
		return ageCate;
	}


	/**
	 * @param ageCate the ageCate to set
	 */
	public void setAgeCate(String ageCate) {
		this.ageCate = ageCate;
	}
	
	
}